import http from "@/api/axios";

export const getListApi = (data: Base.GeneraDataType) => {
  return http({
    method: "post",
    url: "/base/biz/user/page",
    data
  });
};
export const addUserApi = (data: Base.GeneraDataType) => {
  return http({
    method: "post",
    url: "/base/biz/user",
    data
  });
};
export const editUserApi = (data: Base.GeneraDataType) => {
  return http({
    method: "put",
    url: "/base/biz/user",
    data
  });
};
export const deleteUserApi = (data: { id: string }) => {
  return http({
    method: "delete",
    url: "/base/biz/user",
    data
  });
};
export const disabledUserApi = (data: { id: string }) => {
  return http({
    method: "put",
    url: "/base/biz/user/disabled",
    data
  });
};
export const enabledUserApi = (data: { id: string }) => {
  return http({
    method: "put",
    url: "/base/biz/user/enabled",
    data
  });
};
// 获取用户详情
export const getUserDetailsApi = (data: { id: string }) => {
  return http({
    method: "post",
    url: "/base/biz/user/info",
    data
  });
};
export const getUserInfoApi = (data: { id: string }) => {
  return http({
    method: "post",
    url: "/base/biz/user/query/id",
    data
  });
};
// 部门树形
export const getDeptTreeApi = (data: Base.GeneraDataType = {}) => {
  return http({
    method: "post",
    url: "/base/biz/dept/tree",
    data
  });
};
// 设置主管
export const setDepartManagerApi = (data: { id: string; managerId: string }) => {
  return http({
    method: "post",
    url: "/base/biz/dept/manager",
    data
  });
};
// 新增部门
export const addDepartApi = (data: Base.GeneraDataType) => {
  return http({
    method: "post",
    url: "/base/biz/dept",
    data
  });
};
// 编辑部门
export const modifyDepartApi = (data: Base.GeneraDataType) => {
  return http({
    method: "put",
    url: "/base/biz/dept",
    data
  });
};
// 删除部门
export const deleteDepartApi = (data: { id: string }) => {
  return http({
    method: "delete",
    url: "/base/biz/dept",
    data
  });
};
// 批量修改部门
export const batchModifyDepartApi = (data: Base.GeneraDataType) => {
  return http({
    method: "post",
    url: "/base/biz/user/batch-update-dept",
    data
  });
};
// 获取公司
export const getAllCompanyApi = (data: Base.GeneraDataType = {}) => {
  return http({
    method: "post",
    url: "/base/biz/dept/company",
    data
  });
};
// 根据岗位筛选用户
export const getUserByPositionApi = (data: Base.GeneraDataType = {}) => {
  return http({
    method: "post",
    url: "/base/biz/user/page/position",
    data
  });
};
// 修改 公司信息
export const modifyCompanyInfoApi = (data: Base.GeneraDataType) => {
  return http({
    method: "put",
    url: "/base/biz/dept/company",
    data
  });
};
// 获取公司信息
export const getCompanyInfoApi = (data: { id: string }) => {
  return http({
    method: "post",
    url: "/base/biz/dept/info",
    data
  });
};

// 批量导入用户模版下载
export const importDownloadApi = (formData: FormData) => {
  return http({
    method: "post",
    url: "/base/biz/user/batchUpload",
    data: formData,
    headers: {
      "Content-type": "multipart/form-data"
    }
  });
};

// 用户管理 - 重置密码
export const resetUserPasswordApi = (data: { id: string; password: string }) => {
  return http({
    method: "post",
    url: "/base/biz/user/rest/pwd",
    data
  });
};
